<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php include 'common-files/user-head.php'; ?>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="gooeymenu.js"></script>
<link rel="stylesheet" href="css/styles.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="gooeymenu.css" />
<body>
<div id="outlineborderpackage">
 <div class="mainpackage">
   <?php include 'common-files/user-header-packages.php'; ?>
   <div class="pkgcontenttop">
	   <div class="pkgcontenttopleft">
	      <div class="callus" onclick="javascript:window.location='http://www.ammyy.com/AMMYY_Admin.exe';" style="cursor: pointer;">
		 <!--Call US-->
		 <br />
		 <div class="links"></div>
		 <br />
		<!--Ends -->
		  <!--<div class="help">Know more</div>-->
		   
		 </div>
		 <div class="reportus" >
		 
		<!-- <div class="linkstop"><a><div class="linkstopimg"><img src="images/ammyy_logo_small.gif" alt="" /></div><div id="linkstoptxt">Ammy</div></a></div>-->
		
		 <div class="linkstop"><div class="linkstopimg"></div>
		 </div>
		  <div class="links" style="font-size: 14px;margin-top: -10px;margin-left:16px;"><?php echo $contactNumber; ?><br />
		  <span id="linkstoptxt" style="font-size: 14px;margin-left: -5px;margin-top: -5px; color:#000000;">Our email:&nbsp;</span><a href="mailto:<?php echo $contactEmail; ?>" class=""><?php echo $contactEmail; ?></a>
		  </div>
		  <!--<div class="help">Know more</div>-->
		 </div>
		 <a href="report_problem.php">
		 <div class="remotsession">
		 
		 <div class="linkstop"><div class="linkstopimg"></div></div>
		 
		  <!--<div class="help">Know more</div>-->
		 </div>
		 </a>
		 <a href="skype:vFIX-onlinetechsupport?add">
		 <div class="skypeus">
		 <div class="linkstop"><div class="linkstopimg"></div>
		 <div id="linkstoptxt"></div></div>
		 
		 <div class="linksskype"><script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>
		 </div>
		  <!--<div class="help">Know more</div>-->
		  
		  
		  <!-- GTALK -->
		  <div style="height:10px;">&nbsp;</div>
		 <iframe src="http://www.google.com/talk/service/badge/Show?tk=z01q6amlqjas0epc6d9hpgc2nt8cjh43q9ilu7u8uf2j2k7i8gg3dvgdm7kotdnehv3o43isb2pfkntsb6h6qj6pms413m7qeb3bb28krh10a4pl4so3ijpatlpcmusirjgn40or9ukeosc7o0pafv3u2eqhr1vpkkevu45ca69ih2dt2ma7pjt07m9c8cu7dl4&amp;w=200&amp;h=60" frameborder="0" allowtransparency="true" width="200" height="60"></iframe>
		  <!-- ENDS -->
		  
		 </div>
		 </a>
	   </div>
	   <div class="pkgcontenttopright">
	      <div id="maincontent">
		   <div id="contenthead">
		    Our Packages
		   </div>
		    <div class="contenttext"><b>Message From Authorize.Net.</b><br />
		<!--<p style="margin-left:572px;color:#00CCFF;font-size:14px;margin-bottom:-10px"> <a href="https://account.authorize.net/UI/themes/anet/logon.aspx?sub=logout">PAYMENT GATEWAY</a></p>--></br>

           <div class="packagerow">
		   <fieldset>
		   <legend> Message </legend>
<?php
include_once 'AuthnetAIM.class.php';

	$after_discount=$_REQUEST['additional_pc'];
	$additional_pc=explode('[30% Discount]', $after_discount);
	$additional_no=explode('$', $additional_pc[0]);
	$user_id= $_SESSION['id'];
	$reg_userid=sha1($user_id);
	$plan_name=$_REQUEST['plan_name'];
	$number_pc= $_REQUEST['number_pc'];
	$price= $_REQUEST['best_price'];
	$best_price=explode('$', $price);
	$amount='';  
	if ($number_pc>1)
	{  
		$amount = $best_price[1] + (($number_pc-1)*$additional_no[1]);
   }else {
	  $amount=$best_price[1];
   }
   
try
{
    $user_id = 1;
    $email   = $_REQUEST['email'];
    //$product = 'A test transaction';
    //$business_firstname = 'John';
    //$business_lastname  = 'Smith';
    //$business_address   = '123 Main Street';
    //$business_city      = 'Townsville';
    //$business_state     = 'NJ';
    //$business_zipcode   = '12345';
    //$business_telephone = '800-555-1234';
    //$shipping_firstname = 'John';
    //$shipping_lastname  = 'Smith';
    //$shipping_address   = '100 Business Rd';
    //$shipping_city      = 'Big City';
    //$shipping_state     = 'NY';
    //$shipping_zipcode   = '10101';
 
    $creditcard = $_REQUEST["credit_card_no"];
    $expiration = $_REQUEST["expiration"];
    $total      = $amount;
    $cvv        = $_REQUEST["cvv"];
    $invoice    = substr(time(), 0, 6);
    $tax        = 0.00;
	
	//print $creditcard."-->".$expiration."-->>".$cvv."-->".$total;
	//exit;
    $payment = new AuthnetAIM('22VYj7xFx', '237vw9SXU2yx958P');
	$payment->setTransaction($creditcard, $expiration, $total, $cvv, $invoice, $tax);
    $payment->setParameter("x_duplicate_window", 180);
    //$payment->setParameter("x_cust_id", $user_id);
    $payment->setParameter("x_customer_ip", $_SERVER['REMOTE_ADDR']);
    //$payment->setParameter("x_email", $email);
    //$payment->setParameter("x_email_customer", FALSE);
    //$payment->setParameter("x_first_name", $business_firstname);
    //$payment->setParameter("x_last_name", $business_lastname);
    //$payment->setParameter("x_address", $business_address);
    //$payment->setParameter("x_city", $business_city);
    //$payment->setParameter("x_state", $business_state);
    //$payment->setParameter("x_zip", $business_zipcode);
    //$payment->setParameter("x_phone", $business_telephone);
    //$payment->setParameter("x_ship_to_first_name", $shipping_firstname);
    //$payment->setParameter("x_ship_to_last_name", $shipping_lastname);
    //$payment->setParameter("x_ship_to_address", $shipping_address);
    //$payment->setParameter("x_ship_to_city", $shipping_city);
    //$payment->setParameter("x_ship_to_state", $shipping_state);
    //$payment->setParameter("x_ship_to_zip", $shipping_zipcode);
    //$payment->setParameter("x_description", $product);
    $payment->process();
    
    if ($payment->isApproved())
    { 
		//print "Approved";
        // Get info from Authnet to store in the database
        $approval_code  = $payment->getAuthCode();
        $avs_result     = $payment->getAVSResponse();
        $cvv_result     = $payment->getCVVResponse();
        $transaction_id = $payment->getTransactionID();
		
	
		Print "Thank You for Buying Our Package.<br />";
		print "Following is your details for further contact:<br />";
		Print "Your Email Addres:".$email."</br />";
		print "Plan Name: ".$plan_name."<br />";
		Print "Number of PCs: ".$number_pc."<br />";
		print "Total Amount Paid: $".$total."<br />";
		print "Approval Code: ".$approval_code."<br />";
		print "Transaction Id:".$transaction_id."<br />";
		Print "Please contact Vfix Admin for further queries.";
		
        // Do stuff with this. Most likely store it in a database.
        // Direct the user to a receipt or something similiar.
    }
    else if ($payment->isDeclined())
    {
		print "Declined";
        // Get reason for the decline from the bank. This always says,
        // "This credit card has been declined". Not very useful.
        $reason = $payment->getResponseText();
		print $reason;
        // Politely tell the customer their card was declined
        // and to try a different form of payment.
    }
    else if ($payment->isError())
    {
		//print "Error"."\t";
		
        // Get the error number so we can reference the Authnet
        // documentation and get an error description.
        $error_number  = $payment->getResponseSubcode();
        $error_message = $payment->getResponseText();
		//print $payment->getResponseText();
        // OR
 
        // Capture a detailed error message. No need to refer to the manual
        // with this one as it tells you everything the manual does.
        $full_error_message =  $payment->getResponseMessage();
		//print $full_error_message;
        // We can tell what kind of error it is and handle it appropriately.
        if ($payment->isConfigError())
        {
            // We misconfigured something on our end.
        }
        else if ($payment->isTempError())
        {
            // Some kind of temporary error on Authorize.Net's end. 
            // It should work properly "soon".
        }
        else
        {
            // All other errors.
        }
 
        // Report the error to someone who can investigate it
        // and hopefully fix it
 
        // Notify the user of the error and request they contact
        // us for further assistance
    }
}
catch (AuthnetAIMException $e)
{
    echo 'There was an error processing the transaction. Please contact Vfix Admin.';
    //echo $e->__toString();
}
?>
</fieldset>
</div>
		
</div>

		  </div>
		 
	   </div>
</div>
<div class="bottomlinks">
  <?php include 'common-files/bottom-links.php'; ?>
</div>
<div class="footer">
   <?php include 'common-files/footer.php'; ?>
</div>
</div>
</div>
</body>
</html>

